/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewProcess.java
 *
 * Created on Nov 9, 2010, 12:13:39 PM
 */

package mpr;

import java.awt.Component;
import javax.swing.JFileChooser;
import javax.swing.JFrame;

/**
 *
 * @author Ephraim
 */
public class NewProcess extends javax.swing.JFrame {
    JFrame main;
    /** Creates new form NewProcess */
    public NewProcess(JFrame main) {
        initComponents();
        this.main = main;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        newPane = new javax.swing.JLayeredPane();
        blankRButton = new javax.swing.JRadioButton();
        importRButton = new javax.swing.JRadioButton();
        Title = new javax.swing.JLabel();
        newNameField = new javax.swing.JTextField();
        cancelButton = new javax.swing.JButton();
        browseButton = new javax.swing.JButton();
        okButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("New");

        blankRButton.setText("Blank Template");
        blankRButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                blankRButtonActionPerformed(evt);
            }
        });
        blankRButton.setBounds(20, 100, 170, 23);
        newPane.add(blankRButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        importRButton.setText("Import PNG Image");
        importRButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                importRButtonActionPerformed(evt);
            }
        });
        importRButton.setBounds(20, 130, 120, 23);
        newPane.add(importRButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        Title.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        Title.setText("New File");
        Title.setBounds(10, 10, 140, 20);
        newPane.add(Title, javax.swing.JLayeredPane.DEFAULT_LAYER);
        newNameField.setBounds(70, 50, 200, 20);
        newPane.add(newNameField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });
        cancelButton.setBounds(290, 80, 90, 23);
        newPane.add(cancelButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        browseButton.setText("Browse");
        browseButton.setEnabled(false);
        browseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                browseButtonActionPerformed(evt);
            }
        });
        browseButton.setBounds(180, 130, 90, 23);
        newPane.add(browseButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        okButton.setText("Ok");
        okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okButtonActionPerformed(evt);
            }
        });
        okButton.setBounds(290, 50, 90, 23);
        newPane.add(okButton, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator1.setBounds(20, 160, 250, 10);
        newPane.add(jSeparator1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setText("Name :");
        jLabel2.setBounds(20, 50, 40, 20);
        newPane.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator2.setBounds(10, 30, 380, 10);
        newPane.add(jSeparator2, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator3.setBounds(20, 90, 250, 10);
        newPane.add(jSeparator3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(newPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(newPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
        final JFileChooser fc = new JFileChooser();
        int returnVal = fc.showOpenDialog(null);

        
}//GEN-LAST:event_browseButtonActionPerformed

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
    this.dispose();
}//GEN-LAST:event_cancelButtonActionPerformed

    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
        this.dispose();
        mainMenu.dummyNewPane.setVisible(true);
        mainMenu.windowSymbols.setVisible(true);
}//GEN-LAST:event_okButtonActionPerformed

    private void blankRButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_blankRButtonActionPerformed


        if (blankRButton.isSelected())
        {
            importRButton.setSelected(false);
            browseButton.setEnabled(false);
        }
    }//GEN-LAST:event_blankRButtonActionPerformed

    private void importRButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importRButtonActionPerformed

        if (importRButton.isSelected())
        {
            blankRButton.setSelected(false);
            browseButton.setEnabled(true);
        }
    }//GEN-LAST:event_importRButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
           //     new NewProcess().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Title;
    private javax.swing.JRadioButton blankRButton;
    private javax.swing.JButton browseButton;
    private javax.swing.JButton cancelButton;
    private javax.swing.JRadioButton importRButton;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JTextField newNameField;
    private javax.swing.JLayeredPane newPane;
    private javax.swing.JButton okButton;
    // End of variables declaration//GEN-END:variables

}
